package cn.tedu.property.admin.security;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        //表单提交---自定义登录页面
       http.formLogin().
               loginProcessingUrl("/login").
               loginPage("/login.html");

       //授权认证
       http.authorizeRequests().
               antMatchers(
                       "/login.html",
                                   "/images/*",
                                   "/css/*",
                                   "/js/*",
                                   "/lib/*",
                                   "/ueditor/*",
                                    "/vue/*",
                                    "/vue-select/*").permitAll().
               //任何请求都需要被验证
               anyRequest().authenticated();


       http.csrf().disable();
    }


}
